// Forget everything stuck in your way
// Just take down T1 and enjoy your day
#include "graph.h"
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;

const int N=205;
vector<pair<int,int>> tr[N];
vector<int> dg[N];
int n,deg[N],dep[N],devo[N][N],used[N][N],g[N][N],cnt[N]; // stores the depth of each devolution edge
void dfs1(int x,int lst) { // build the DFS tree
	deg[x]=NumberOfRoads();
	for (int i=1;i<=deg[x];i++){
		if (i==lst) continue;
		Move(i,2);
		int lr=LastRoad();
		if (Color()==2) {
			dg[x].push_back (i);
			Move(lr,2);
		}
		else if (Color()==1){
			n++;
			tr[x].push_back ({n,i});
			dfs1(n,lr);
			Move(lr,3);
		}
		else Move(lr,3);
	}
}
int getpow (int d) {
	int ans=1;
	while (d--) ans*=3;
	return ans;
}
int getbit (int x,int d) {
	while (d--) x/=3;
	return x%3;
}
void dfs2(int x,int d) {
	int col=getbit(x,d)+1;
	for (auto i:tr[x]) {
		Move(i.se,col);
		int lr=LastRoad();
		dfs2(i.fi,d);
		Move(lr,Color());
	}
	for (int i:dg[x]) {
		Move(i,col);
		int lr=LastRoad();
		devo[x][i]+=(Color()-1)*getpow(d);
		Move(lr,Color());
	}
}
void dfs3(int x) {
	for (auto i:tr[x]) {
		g[x][i.fi]=g[i.fi][x]=1;
		dfs3(i.fi);
	}
	for (int i:dg[x]) {
		g[x][devo[x][i]]=g[devo[x][i]][x]=1;
	}
}
void Inspect(int r) {
	n=1;
    dfs1(1,0);
    for (int i=0;i<=4;i++) dfs2(1,i);
    for (int i=1;i<=n;i++) {
    	for (int j=1;j<=n;j++) g[i][j]=i==j?0:0x3f3f3f3f;
	}
	dfs3(1);
	for (int k=1;k<=n;k++) {
		for (int i=1;i<=n;i++) {
			for (int j=1;j<=n;j++) {
				g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
			}
		}
	}
	for (int i=1;i<=n;i++) {
		for (int j=i+1;j<=n;j++) {
			if (g[i][j]<=n) cnt[g[i][j]]++;
		}
	}
	for (int i=1;i<=r;i++) Answer(i,cnt[i]);
}
